<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 7.3.0">

  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.ico">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha256-wiz7ZSCn/btzhjKDQBms9Hx4sSeUYsDrTLg7roPstac=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.css" integrity="sha256-6cQIC71/iBIYXFK+0RHAvwmjwWzkWd+r7v/BX3/vZDc=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/themes/green/pace-theme-minimal.css">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/pace.min.js" integrity="sha256-gqd7YTjg/BtfqWSwsJOvndl0Bxc8gFImLEkXQT8+qj0=" crossorigin="anonymous"></script>

<script class="next-config" data-name="main" type="application/json">{"hostname":"sumumm.github.io","root":"/","images":"/images","scheme":"Gemini","darkmode":false,"version":"8.19.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":true,"style":"mac"},"fold":{"enable":true,"height":300},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":true,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":true,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>

    <meta name="description" content="本文主要是STM32开发——链接文件分析的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:type" content="article">
<meta property="og:title" content="LV16-07-开发工具-04-ld链接文件">
<meta property="og:url" content="https://sumumm.github.io/post/ebcf2720.html">
<meta property="og:site_name" content="苏木">
<meta property="og:description" content="本文主要是STM32开发——链接文件分析的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2023-06-04T14:06:39.000Z">
<meta property="article:modified_time" content="2025-06-13T16:25:57.008Z">
<meta property="article:author" content="苏木">
<meta property="article:tag" content="LV16-STM32开发">
<meta name="twitter:card" content="summary">


<link rel="canonical" href="https://sumumm.github.io/post/ebcf2720.html">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"https://sumumm.github.io/post/ebcf2720.html","path":"post/ebcf2720.html","title":"LV16-07-开发工具-04-ld链接文件"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>LV16-07-开发工具-04-ld链接文件 | 苏木</title>
  








    <script src="/js/browser_tools_disable.js"></script>

  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
<!-- hexo injector head_end start --><link rel="stylesheet" href="https://unpkg.com/hexo-next-tags-plus@latest/lib/tag_plus.css" media="defer" onload="this.media='all'"><!-- hexo injector head_end end --></head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <div class="column">
      <header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">苏木</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">我的学习之路</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger" aria-label="搜索" role="button">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>苏木的家</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类页<span class="badge">42</span></a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档页<span class="badge">673</span></a></li><li class="menu-item menu-item-flink"><a href="/flink/" rel="section"><i class="fa fa-link fa-fw"></i>友人帐</a></li><li class="menu-item menu-item-about"><a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于我</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</header>
        
  
  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%80%E3%80%81%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99"><span class="nav-text">一、参考资料</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BA%8C%E3%80%81%E4%B8%80%E4%B8%AA%E5%AE%8C%E6%95%B4%E7%9A%84%E9%93%BE%E6%8E%A5%E6%96%87%E4%BB%B6"><span class="nav-text">二、一个完整的链接文件</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%89%E3%80%81%E5%90%84%E9%83%A8%E5%88%86%E8%AF%B4%E6%98%8E"><span class="nav-text">三、各部分说明</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E5%85%A5%E5%8F%A3%E4%B8%8E%E5%A0%86%E6%A0%88"><span class="nav-text">1. 入口与堆栈</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E5%86%85%E5%AD%98%E5%B8%83%E5%B1%80"><span class="nav-text">2. 内存布局</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-1-MEMORY"><span class="nav-text">2.1 MEMORY</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-%E5%AE%9E%E4%BE%8B%E5%88%86%E6%9E%90"><span class="nav-text">2.2 实例分析</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E6%AE%B5%E7%9A%84%E5%AE%9A%E4%B9%89"><span class="nav-text">3. 段的定义</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#3-1-SECTIONS"><span class="nav-text">3.1 SECTIONS</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#3-1-1-%E6%A1%86%E6%9E%B6"><span class="nav-text">3.1.1 框架</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3-1-2-command"><span class="nav-text">3.1.2 command</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-2-%E6%AE%B5%E7%9A%84%E4%BD%9C%E7%94%A8"><span class="nav-text">3.2 段的作用</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-2-isr-vector"><span class="nav-text">3.2 isr_vector</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-3-text"><span class="nav-text">3.3 text</span></a></li></ol></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%9B%9B%E3%80%81%E5%A4%9A%E4%B8%AA%E9%93%BE%E6%8E%A5%E8%84%9A%E6%9C%AC"><span class="nav-text">四、多个链接脚本</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E6%96%B0%E5%BB%BA%E9%93%BE%E6%8E%A5%E8%84%9A%E6%9C%AC-mine-ld"><span class="nav-text">1. 新建链接脚本 mine.ld</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E4%BF%AE%E6%94%B9Makefile"><span class="nav-text">2. 修改Makefile</span></a></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="苏木"
      src="/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">苏木</p>
  <div class="site-description" itemprop="description">莫道桑榆晚，为霞尚满天</div>
</div>
<div class="site-state-wrap animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">673</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">42</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
        <span class="site-state-item-count">43</span>
        <span class="site-state-item-name">标签</span>
      </div>
  </nav>
</div>
  <div class="links-of-author animated">
      <span class="links-of-author-item">
        <a href="https://github.com/sumumm" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;sumumm" rel="noopener me" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
  </div>

        </div>
      </div>
    </div>

    
  </aside>


    </div>

    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://sumumm.github.io/post/ebcf2720.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.jpg">
      <meta itemprop="name" content="苏木">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="苏木">
      <meta itemprop="description" content="莫道桑榆晚，为霞尚满天">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="LV16-07-开发工具-04-ld链接文件 | 苏木">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          LV16-07-开发工具-04-ld链接文件
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2023-06-04 22:06:39" itemprop="dateCreated datePublished" datetime="2023-06-04T22:06:39+08:00">2023-06-04</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/" itemprop="url" rel="index"><span itemprop="name">嵌入式开发</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/" itemprop="url" rel="index"><span itemprop="name">01HQ课程体系</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV16-STM32%E5%BC%80%E5%8F%91/" itemprop="url" rel="index"><span itemprop="name">LV16-STM32开发</span></a>
        </span>
    </span>

  
    <span class="post-meta-break"></span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>4.8k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>18 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody"><p>本文主要是STM32开发——链接文件分析的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。</p>
<span id="more"></span>

<!-- Photo: https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV16-STM32%E5%BC%80%E5%8F%91/LV16-07-%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7-04-ld%E9%93%BE%E6%8E%A5%E6%96%87%E4%BB%B6/img/ -->

<details class="folding-tag" blue><summary> 点击查看使用工具及版本 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center" width=150px>Windows</td>        <td align="left">windows11</td>    </tr>    <tr>        <td align="center">Ubuntu</td>        <td align="left">Ubuntu16.04的64位版本</td>      </tr>    <tr>        <td align="center">VMware® Workstation 16 Pro</td>        <td align="left">16.2.3 build-19376536</td>      </tr>    <tr>        <td align="center">SecureCRT</td>        <td align="left">Version 8.7.2 (x64 build 2214)   -   正式版-2020年5月14日</td>      </tr>    <tr>        <td align="center">开发板</td>        <td align="left">正点原子 i.MX6ULL Linux阿尔法开发板</td>      </tr>    <tr>        <td align="center">uboot</td>        <td align="left">NXP官方提供的uboot，NXP提供的版本为uboot-imx-rel_imx_4.1.15_2.1.0_ga(使用的uboot版本为U-Boot 2016.03)</td>      </tr>    <tr>        <td align="center">linux内核</td>        <td align="left">linux-4.15(NXP官方提供)</td>      </tr>    <tr>        <td align="center">STM32开发板</td>        <td align="left">正点原子战舰V3(STM32F103ZET6)</td>      </tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看本文参考资料 </summary>
              <div class='content'>
              <ul><li>通用</li></ul><table><tr><td align="center">分类  </td><td align="center">网址</td><td align="center">说明</td></tr><tr><td align="center" rowspan="4">官方网站</td><td align="left"><a href="https://www.arm.com/" target="_blank">https://www.arm.com/</a></td><td align="left">ARM官方网站，在这里我们可以找到Cotex-Mx以及ARMVx的一些文档</td></tr><tr>                                            <td align="left"><a href="https://www.st.com/content/st_com/zh.html" target="_blank">https://www.st.com/content/st_com/zh.html</a></td><td align="left">ST官方网站，在这里我们可以找到STM32的相关文档</td></tr><tr>                                            <td align="left"><a href="https://www.stmcu.com.cn/" target="_blank">https://www.stmcu.com.cn/</a></td><td align="left">意法半导体ST中文官方网站，在这里我们可以找到STM32的相关中文参考文档</td></tr><tr>                                            <td align="left"><a href="http://elm-chan.org/fsw/ff/00index_e.html" target="_blank">http://elm-chan.org/fsw/ff/00index_e.html</a></td><td align="left">FatFs文件系统官网</td></tr><tr><td align="center" rowspan="3">教程书籍</td><td align="left"><a href="STM32开发相关资料/01ARM参考资料/ARM Cortex-M3权威指南(中文).pdf" target="_blank">《ARM Cortex-M3权威指南》</a></td><td alirn="left" rowspan="3">ARM公司专家Joseph Yiu（姚文祥）的力作，中文翻译是NXP的宋岩</td></tr><tr>                                            <td align="left"><a href="STM32开发相关资料/01ARM参考资料/ARM Cortex-M0权威指南(中文).pdf" target="_blank">《ARM Cortex-M0权威指南》</a></td></tr><tr>                                            <td align="left"><a href="" target="_blank">《ARM Cortex-M3与Cortex-M4权威指南》</a></td></tr><tr><td align="center" rowspan="4">开发论坛</td><td align="left"><a href="http://47.111.11.73/forum.php" target="_blank">http://47.111.11.73/forum.php</a></td><td align="left">开源电子网，正点原子的资料下载及问题讨论论坛</td></tr><tr>                                            <td align="left"><a href="https://www.firebbs.cn/forum.php" target="_blank">https://www.firebbs.cn/forum.php</a></td><td align="left">国内Kinetis开发板-野火/秉火（刘火良）主持的论坛，现也做STM32和i.MX RT</td></tr><tr>                                            <td align="left"><a href="https://www.amobbs.com/index.php" target="_blank">https://www.amobbs.com/index.php</a></td><td align="left">阿莫（莫进明）主持的论坛，号称国内最早最火的电子论坛，以交流Atmel AVR系列单片机起家，现已拓展到嵌入式全平台，其STM32系列帖子有70W+。</td></tr><tr>                                            <td align="left"><a href="http://download.100ask.net/index.html" target="_blank">http://download.100ask.net/index.html</a></td><td align="left">韦东山嵌入式资料中心，有些STM32和linux的相关资料也可以来这里找。</td></tr><tr><td align="center" rowspan="3">博客参考</td><td align="left"><a href="http://www.openedv.com/" target="_blank">http://www.openedv.com/</a></td><td align="left">开源网-原子哥个人博客</td></tr><tr>                                            <td align="left"><a href="http://blog.chinaaet.com/jihceng0622" target="_blank">http://blog.chinaaet.com/jihceng0622</a></td><td align="left">博主是原Freescale现NXP的现场应用工程师</td></tr><tr>                                            <td align="left"><a href="https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/cortex-m-resources" target="_blank">cortex-m-resources</a></td><td align="left">这其实并不算是一个博客，这是ARM公司专家Joseph Yiu收集整理的所有对开发者有用的官方Cortex-M资料链接（也包含极少数外部资源链接）</td></tr></table><ul><li>STM32</li></ul><table>    <tr><td align="center" rowspan="2">STM32</td><td align="left"><a href="https://doc.embedfire.com/mcu/stm32/f103/hal_general/zh/latest/index.html" target="_blank">STM32 HAL库开发实战指南——基于F103系列开发板</a></td><td align="left">野火STM32开发教程在线文档</td></tr><tr>                                            <td align="left"><a href="https://doc.embedfire.com/mcu/stm32/f103badao/std/zh/latest/index.html" target="_blank">STM32库开发实战指南——基于野火霸道开发板</a></td><td align="left">野火STM32开发教程在线文档</td></tr></table><ul><li>SD卡</li></ul><table>    <tr><td align="left"><a href="https://www.sdcard.org/" target="_blank">SD Association</a></td><td align="left">提供了SD存储卡和SDIO卡系统规范</td></tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看相关文件下载 </summary>
              <div class='content'>
              <table>    <tr><td align="left"><a href="https://www.st.com/resource/en/datasheet/stm32f103ze.pdf" target="_blank">STM32F103xx英文数据手册</a></td><td align="left">STM32F103xC/D/E系列的英文数据手册</td></tr>    <tr><td align="left"><a href="https://www.stmcu.com.cn/Designresource/detail/localization_document%20/709978" target="_blank">STM32F103xx中文数据手册</a></td><td align="left">STM32F103xC/D/E系列的中文数据手册</td></tr>    <tr><td align="left"><a href="https://www.st.com/resource/en/reference_manual/rm0008-stm32f101xx-stm32f102xx-stm32f103xx-stm32f105xx-and-stm32f107xx-advanced-armbased-32bit-mcus-stmicroelectronics.pdf" target="_blank">STM32F10xxx英文参考手册（RM0008）</a></td><td align="left">STM32F10xxx系列的英文参考手册</td></tr>    <tr><td align="left"><a href="https://www.stmcu.com.cn/Designresource/detail/localization_document%20/710001" target="_blank">STM32F10xxx中文参考手册（RM0008）</a></td><td align="left">STM32F10xxx系列的中文参考手册</td></tr>    <tr><td align="left"><a href="https://developer.arm.com/documentation/100165/0201/?lang=en" target="_blank">Arm Cortex-M3 处理器技术参考手册-英文版</a></td><td align="left">Cortex-M3技术参考手册-英文版</td></tr>    <tr><td align="left"><a href="https://www.st.com/resource/en/programming_manual/pm0056-stm32f10xxx20xxx21xxxl1xxxx-cortexm3-programming-manual-stmicroelectronics.pdf" target="_blank">STM32F10xxx Cortex-M3编程手册-英文版(PM0056)</a></td><td align="left">STM32F10xxx/20xxx/21xxx/L1xxxx系列Cortex-M3编程手册-英文版</td></tr>    <tr><td align="left"><a href="https://www.sdcard.org/downloads/pls/" target="_blank">SD卡相关资料——最新版本</a></td><td align="left">有关SD卡的一些资料可以从这里下载</td></tr>    <tr><td align="left"><a href="https://www.sdcard.org/downloads/pls/archives/" target="_blank">SD卡相关资料——历史版本</a></td><td align="left">有关SD卡的一些历史版本资料可以从这里下载，比如后边看的SD卡2.0协议</td></tr>    <tr><td align="left"><a href="./" target="_blank">SD 2.0 协议标准完整版</a></td><td align="left">这是一篇关于SD卡2.0协议的中文文档，还是比较有参考价值的，可以一看</td></tr></table>
              </div>
            </details> 

<p>这篇笔记主要是STM32CubeMX软件生成的STM32F103ZETx_FLASH.ld链接文件的学习笔记。这篇笔记按照顺序从上到下分析STM32F103ZETx_FLASH.ld文件。关于GNU链接脚本的详细语法我们可以参考这里：<a target="_blank" rel="noopener" href="https://sourceware.org/binutils/docs/">Documentation for binutils 2.40 (sourceware.org)</a>，这里好像还有在线的文档。<strong>【注意】</strong>生成Makefile文件的话，链接脚本是自动生成的，并且每一次重新生成的时候，<strong>链接脚本将会重新生成</strong>，也就是说，若是我们修改了链接脚本内容的话，只要我们通过STM32CubeMX更新工程，我们修改的部分都会被删除。</p>
<h1 id="一、参考资料"><a href="#一、参考资料" class="headerlink" title="一、参考资料"></a><font size=3>一、参考资料</font></h1><p>关于链接脚本，其实在GNU的官方文档中是有相关的内容的。</p>
<ul>
<li>GNU官网：<a target="_blank" rel="noopener" href="https://www.gnu.org/">GNU 操作系统和自由软件运动</a></li>
<li>Documentation for binutils 2.40 ：<a target="_blank" rel="noopener" href="https://sourceware.org/binutils/docs/">Documentation for binutils 2.40 (sourceware.org)</a></li>
<li>Linker (ld) 在线文档：<a target="_blank" rel="noopener" href="https://sourceware.org/binutils/docs/ld.pdf">ld.pdf (sourceware.org)</a></li>
</ul>
<p>GNU与GCC什么关系？这里简单了解一下吧，至少知道为什么我们找链接脚本的语法要到GNU的官网去，我查了下维基百科，是这样说的：</p>
<p><strong>GNU编译器套装</strong>（英语：<strong>GNU Compiler Collection</strong>，缩写为<strong>GCC</strong>）是<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/GNU%E8%A8%88%E5%8A%83">GNU计划</a>制作的一种<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/w/index.php?title=%E4%BC%98%E5%8C%96%E7%BC%96%E8%AF%91%E5%99%A8&action=edit&redlink=1">优化编译器</a>，支持各种<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/%E7%B7%A8%E7%A8%8B%E8%AA%9E%E8%A8%80">编程语言</a>、<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F">操作系统</a>、<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%B3%BB%E7%BB%9F%E7%BB%93%E6%9E%84">计算机系统结构</a>。该编译器是以<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/GPL">GPL</a>及<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/LGPL">LGPL</a>许可证所发行的<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/%E8%87%AA%E7%94%B1%E8%BB%9F%E9%AB%94">自由软体</a>，也是<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/GNU%E8%A8%88%E5%8A%83">GNU计划</a>的关键部分，还是<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/GNU%E5%B7%A5%E5%85%B7%E9%93%BE">GNU工具链</a>的主要组成部份之一。GCC（特别是其中的C语言编译器）也常被认为是跨平台编译器的事实标准。1985年由<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/%E7%90%86%E6%9F%A5%E5%BE%B7%C2%B7%E9%A9%AC%E4%BF%AE%C2%B7%E6%96%AF%E6%89%98%E6%9B%BC">理查德·马修·斯托曼</a>开始发展，现在由<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/%E8%87%AA%E7%94%B1%E8%BB%9F%E9%AB%94%E5%9F%BA%E9%87%91%E6%9C%83">自由软体基金会</a>负责维护工作。截至2019年，GCC大约有1500万行代码，是现存最大的自由程序之一。[<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/zh-hans/GCC#cite_note-loc-3">3]</a> 它在自由软件的发展中发挥了重要作用，不仅是一个工具，还是一个典例。</p>
<p>原名为<strong>GNU C语言编译器</strong>（<strong>GNU C Compiler</strong>），因为它原本只能处理<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/C%E8%AA%9E%E8%A8%80">C语言</a>。同年12月，新的GCC编译器可以编译<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/C%2B%2B">C++</a>语言。后来又为<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/Fortran">Fortran</a>、<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/Pascal_(%E7%A8%8B%E5%BC%8F%E8%AA%9E%E8%A8%80)">Pascal</a>、<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/Objective-C">Objective-C</a>、<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/Java">Java</a>、<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/Ada">Ada</a>，<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/Go">Go</a>等其他语言开发了前端。C和C++编译器也支持<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/OpenMP">OpenMP</a>和<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/OpenACC">OpenACC</a>规范。</p>
<p>GCC编译器已经被移植到比其他编译器更多的平台和指令集架构上，并被广泛部署在开发自由和专有软件的工具中。GCC还可用于许多嵌入式系统，包括基于<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/ARM%E6%9E%B6%E6%A7%8B">ARM</a>和<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/w/index.php?title=Power_ISA&action=edit&redlink=1">Power ISA</a>的芯片。</p>
<p>GCC不仅是GNU操作系统的官方编译器，还是许多类UNIX系统和Linux发行版的标准编译器。BSD家族中的大部分操作系统也在GCC发布之后转用GCC；不过FreeBSD、OpenBSD和Apple macOS已经转向了Clang编译器[<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/zh-hans/GCC#cite_note-4">4]</a>，主要是因为许可问题。[<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/zh-hans/GCC#cite_note-5">5]</a>[<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/zh-hans/GCC#cite_note-6">6]</a>[<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/zh-hans/GCC#cite_note-7">7]</a>GCC也可以编译<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/Microsoft_Windows">Windows</a>、<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/Android">Android</a>、<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/IOS">iOS</a>、<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/Solaris">Solaris</a>、<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/HP-UX">HP-UX</a>、<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/IBM_AIX">IBM AIX</a>和<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/DOS">DOS</a>系统的代码。GCC原本用C开发，后来因为<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/LLVM">LLVM</a>、<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/Clang">Clang</a>的崛起，它更快地将开发语言转换为C++。许多C的爱好者在对C++一知半解的情况下主观认定C++的性能一定会输给C，但是Ian Lance Taylor给出了不同的意见，并表明C++不但性能不输给C，而且能设计出更好，更容易维护的程式[<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/zh-hans/GCC#cite_note-8">8]</a>[<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/zh-hans/GCC#cite_note-9">9]</a>。</p>
<h1 id="二、一个完整的链接文件"><a href="#二、一个完整的链接文件" class="headerlink" title="二、一个完整的链接文件"></a><font size=3>二、一个完整的链接文件</font></h1><details class="folding-tag" blue><summary> 点击查看 STM32F103ZETx_FLASH.ld 文件完整内容 </summary>
              <div class='content'>
              <figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br></pre></td><td class="code"><pre><span class="line">/* Entry Point */</span><br><span class="line">ENTRY(Reset_Handler)</span><br><span class="line"></span><br><span class="line">/* Highest address of the user mode stack */</span><br><span class="line">_estack = ORIGIN(RAM) + LENGTH(RAM);    /* end of RAM */</span><br><span class="line">/* Generate a link error if heap and stack don&#x27;t fit into RAM */</span><br><span class="line">_Min_Heap_Size = 0x200;      /* required amount of heap  */</span><br><span class="line">_Min_Stack_Size = 0x400; /* required amount of stack */</span><br><span class="line"></span><br><span class="line">/* Specify the memory areas */</span><br><span class="line">MEMORY</span><br><span class="line">&#123;</span><br><span class="line">RAM (xrw)      : ORIGIN = 0x20000000, LENGTH = 64K</span><br><span class="line">FLASH (rx)      : ORIGIN = 0x8000000, LENGTH = 512K</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">/* Define output sections */</span><br><span class="line">SECTIONS</span><br><span class="line">&#123;</span><br><span class="line">  /* The startup code goes first into FLASH */</span><br><span class="line">  .isr_vector :</span><br><span class="line">  &#123;</span><br><span class="line">    . = ALIGN(4);</span><br><span class="line">    KEEP(*(.isr_vector)) /* Startup code */</span><br><span class="line">    . = ALIGN(4);</span><br><span class="line">  &#125; &gt;FLASH</span><br><span class="line"></span><br><span class="line">  /* The program code and other data goes into FLASH */</span><br><span class="line">  .text :</span><br><span class="line">  &#123;</span><br><span class="line">    . = ALIGN(4);</span><br><span class="line">    *(.text)           /* .text sections (code) */</span><br><span class="line">    *(.text*)          /* .text* sections (code) */</span><br><span class="line">    *(.glue_7)         /* glue arm to thumb code */</span><br><span class="line">    *(.glue_7t)        /* glue thumb to arm code */</span><br><span class="line">    *(.eh_frame)</span><br><span class="line"></span><br><span class="line">    KEEP (*(.init))</span><br><span class="line">    KEEP (*(.fini))</span><br><span class="line"></span><br><span class="line">    . = ALIGN(4);</span><br><span class="line">    _etext = .;        /* define a global symbols at end of code */</span><br><span class="line">  &#125; &gt;FLASH</span><br><span class="line"></span><br><span class="line">  /* Constant data goes into FLASH */</span><br><span class="line">  .rodata :</span><br><span class="line">  &#123;</span><br><span class="line">    . = ALIGN(4);</span><br><span class="line">    *(.rodata)         /* .rodata sections (constants, strings, etc.) */</span><br><span class="line">    *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */</span><br><span class="line">    . = ALIGN(4);</span><br><span class="line">  &#125; &gt;FLASH</span><br><span class="line"></span><br><span class="line">  .ARM.extab   : &#123; *(.ARM.extab* .gnu.linkonce.armextab.*) &#125; &gt;FLASH</span><br><span class="line">  .ARM : &#123;</span><br><span class="line">    __exidx_start = .;</span><br><span class="line">    *(.ARM.exidx*)</span><br><span class="line">    __exidx_end = .;</span><br><span class="line">  &#125; &gt;FLASH</span><br><span class="line"></span><br><span class="line">  .preinit_array     :</span><br><span class="line">  &#123;</span><br><span class="line">    PROVIDE_HIDDEN (__preinit_array_start = .);</span><br><span class="line">    KEEP (*(.preinit_array*))</span><br><span class="line">    PROVIDE_HIDDEN (__preinit_array_end = .);</span><br><span class="line">  &#125; &gt;FLASH</span><br><span class="line">  .init_array :</span><br><span class="line">  &#123;</span><br><span class="line">    PROVIDE_HIDDEN (__init_array_start = .);</span><br><span class="line">    KEEP (*(SORT(.init_array.*)))</span><br><span class="line">    KEEP (*(.init_array*))</span><br><span class="line">    PROVIDE_HIDDEN (__init_array_end = .);</span><br><span class="line">  &#125; &gt;FLASH</span><br><span class="line">  .fini_array :</span><br><span class="line">  &#123;</span><br><span class="line">    PROVIDE_HIDDEN (__fini_array_start = .);</span><br><span class="line">    KEEP (*(SORT(.fini_array.*)))</span><br><span class="line">    KEEP (*(.fini_array*))</span><br><span class="line">    PROVIDE_HIDDEN (__fini_array_end = .);</span><br><span class="line">  &#125; &gt;FLASH</span><br><span class="line"></span><br><span class="line">  /* used by the startup to initialize data */</span><br><span class="line">  _sidata = LOADADDR(.data);</span><br><span class="line"></span><br><span class="line">  /* Initialized data sections goes into RAM, load LMA copy after code */</span><br><span class="line">  .data : </span><br><span class="line">  &#123;</span><br><span class="line">    . = ALIGN(4);</span><br><span class="line">    _sdata = .;        /* create a global symbol at data start */</span><br><span class="line">    *(.data)           /* .data sections */</span><br><span class="line">    *(.data*)          /* .data* sections */</span><br><span class="line"></span><br><span class="line">    . = ALIGN(4);</span><br><span class="line">    _edata = .;        /* define a global symbol at data end */</span><br><span class="line">  &#125; &gt;RAM AT&gt; FLASH</span><br><span class="line"></span><br><span class="line">  </span><br><span class="line">  /* Uninitialized data section */</span><br><span class="line">  . = ALIGN(4);</span><br><span class="line">  .bss :</span><br><span class="line">  &#123;</span><br><span class="line">    /* This is used by the startup in order to initialize the .bss secion */</span><br><span class="line">    _sbss = .;         /* define a global symbol at bss start */</span><br><span class="line">    __bss_start__ = _sbss;</span><br><span class="line">    *(.bss)</span><br><span class="line">    *(.bss*)</span><br><span class="line">    *(COMMON)</span><br><span class="line"></span><br><span class="line">    . = ALIGN(4);</span><br><span class="line">    _ebss = .;         /* define a global symbol at bss end */</span><br><span class="line">    __bss_end__ = _ebss;</span><br><span class="line">  &#125; &gt;RAM</span><br><span class="line"></span><br><span class="line">  /* User_heap_stack section, used to check that there is enough RAM left */</span><br><span class="line">  ._user_heap_stack :</span><br><span class="line">  &#123;</span><br><span class="line">    . = ALIGN(8);</span><br><span class="line">    PROVIDE ( end = . );</span><br><span class="line">    PROVIDE ( _end = . );</span><br><span class="line">    . = . + _Min_Heap_Size;</span><br><span class="line">    . = . + _Min_Stack_Size;</span><br><span class="line">    . = ALIGN(8);</span><br><span class="line">  &#125; &gt;RAM</span><br><span class="line"></span><br><span class="line">  </span><br><span class="line"></span><br><span class="line">  /* Remove information from the standard libraries */</span><br><span class="line">  /DISCARD/ :</span><br><span class="line">  &#123;</span><br><span class="line">    libc.a ( * )</span><br><span class="line">    libm.a ( * )</span><br><span class="line">    libgcc.a ( * )</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  .ARM.attributes 0 : &#123; *(.ARM.attributes) &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
              </div>
            </details>

<h1 id="三、各部分说明"><a href="#三、各部分说明" class="headerlink" title="三、各部分说明"></a><font size=3>三、各部分说明</font></h1><h2 id="1-入口与堆栈"><a href="#1-入口与堆栈" class="headerlink" title="1. 入口与堆栈"></a><font size=3>1. 入口与堆栈</font></h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">/* Entry Point */</span><br><span class="line">ENTRY(Reset_Handler)</span><br><span class="line"></span><br><span class="line">/* Highest address of the user mode stack */</span><br><span class="line">_estack = ORIGIN(RAM) + LENGTH(RAM);    /* end of RAM */</span><br><span class="line">/* Generate a link error if heap and stack don&#x27;t fit into RAM */</span><br><span class="line">_Min_Heap_Size = 0x200;      /* required amount of heap  */</span><br><span class="line">_Min_Stack_Size = 0x400; /* required amount of stack */</span><br></pre></td></tr></table></figure>

<p>（1）第2行：指定入口地址。</p>
<p>（2）第5行：RAM的结束地址</p>
<p>（3）第7、8行：指定堆的大小和栈的大小分别为0x200和0x400。</p>
<h2 id="2-内存布局"><a href="#2-内存布局" class="headerlink" title="2. 内存布局"></a><font size=3>2. 内存布局</font></h2><h3 id="2-1-MEMORY"><a href="#2-1-MEMORY" class="headerlink" title="2.1 MEMORY"></a><font size=3>2.1 MEMORY</font></h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">MEMORY</span><br><span class="line">&#123;</span><br><span class="line">　　&lt;name&gt; [(&lt;attr&gt;)] : ORIGIN = &lt;origin&gt;, LENGTH = &lt;len&gt;</span><br><span class="line">　　...</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>（1）MEMORY关键字用于描述一个MCU ROM和RAM的内存地址分布（Memory Map），MEMORY中所做的内存描述主要用于SECTIONS中LMA和VMA的定义。</p>
<p>（2）name ：是所要定义的内存区域的名字。</p>
<p>（3）attr ：是可选的，并不重要，具体用法可参考GNU Linker的语法说明。</p>
<p>（4）origin ：是其起始地址。</p>
<p>（5）len ：为内存区域的大小，MEMORY语法中可以使用如K、M和G这样的内存单位。</p>
<p>【注意】ORIGIN可以写为org，而LENGTH可以写为l。</p>
<h3 id="2-2-实例分析"><a href="#2-2-实例分析" class="headerlink" title="2.2 实例分析"></a><font size=3>2.2 实例分析</font></h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">/* Specify the memory areas */</span><br><span class="line">MEMORY</span><br><span class="line">&#123;</span><br><span class="line">RAM (xrw)      : ORIGIN = 0x20000000, LENGTH = 64K</span><br><span class="line">FLASH (rx)      : ORIGIN = 0x8000000, LENGTH = 512K</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>这一部分给出地址的划分区间。</p>
<p>（1）RAM和FLASH表示内存名称；</p>
<p>（2）后边的括号表示权限（x:可运行；r:可读；w:可写）；</p>
<p>（3）ORIGIN表示起始地址，LENGTH表示这段内存区域的长度。可以看到这里RAM是可运行可读可写，而FLASH只可运行可读。我们知道STM32的FLASH是可以写的，但这里的权限只针对链接脚本，并不代表代码执行。</p>
<p>我们可以在这里增加一个由malloc使用的MALLOC段，放在外部SRAM上，地址0x68000000：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">/* Specify the memory areas */</span><br><span class="line">MEMORY</span><br><span class="line">&#123;</span><br><span class="line">RAM (xrw)      : ORIGIN = 0x20000000, LENGTH = 64K</span><br><span class="line">FLASH (rx)     : ORIGIN = 0x8000000, LENGTH = 512K</span><br><span class="line">MALLOC(rw)     : ORIGIN = 0x68000000, LENGTH = 512K</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="3-段的定义"><a href="#3-段的定义" class="headerlink" title="3. 段的定义"></a><font size=3>3. 段的定义</font></h2><h3 id="3-1-SECTIONS"><a href="#3-1-SECTIONS" class="headerlink" title="3.1 SECTIONS"></a><font size=3>3.1 SECTIONS</font></h3><h4 id="3-1-1-框架"><a href="#3-1-1-框架" class="headerlink" title="3.1.1 框架"></a><font size=3>3.1.1 框架</font></h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">SECTIONS</span><br><span class="line">&#123;</span><br><span class="line">　　&lt;sections−command&gt;</span><br><span class="line">　　&lt;sections−command&gt;</span><br><span class="line">　　...</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>（1）SECTIONS关键字用于定义output section（输出段）的相应input section（输入段）、LMA和VMA，是整个连接脚本中最为重要的部分。注：output section是实际存储在内存中的“段”，而input section是其构成成员，如.data为数据段，由所有全局变量构成（默认情况下）；.text为代码段，由所有函数构成（默认情况下）。</p>
<h4 id="3-1-2-command"><a href="#3-1-2-command" class="headerlink" title="3.1.2 command"></a><font size=3>3.1.2 command</font></h4><p>主要的部分是 sections−command ，SECTIONS{ }只是属于框架。 sections−command 的语法如下：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">section [address] [(type)] :</span><br><span class="line">[AT(lma)]</span><br><span class="line">[ALIGN(section_align) | ALIGN_WITH_INPUT]</span><br><span class="line">[SUBALIGN(subsection_align)]</span><br><span class="line">[constraint]</span><br><span class="line">&#123;</span><br><span class="line">    output-section-command</span><br><span class="line">    output-section-command</span><br><span class="line">    ...</span><br><span class="line">&#125; [&gt;region] [AT&gt;lma_region] [:phdr :phdr ...] [=fillexp] [,]</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>我们从使用的角度来讲解其语法：（假设有一个全局变量myData，我们用#pragma section命令将其定义为.myData段（input section））</p>
<p>（1）我们首先可以定义output section的名字，随便什么都可以，比如.my_data；</p>
<p>（2）然后我们可以定义其构成成员，*(.myData)；</p>
<p>（3）接下来我们就要指定 .my_data 的LMA和VMA了，有4种方法：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">[&lt;address&gt;] + [AT(&lt;lma&gt;)]</span><br><span class="line"></span><br><span class="line">[&lt;address&gt;] + [AT&gt;&lt;lma region&gt;]</span><br><span class="line"></span><br><span class="line">[&gt;&lt;region&gt;] + [AT&gt;&lt;lma region&gt;]</span><br><span class="line"></span><br><span class="line">[&gt;&lt;region&gt;] + [AT(&lt;lma&gt;)]</span><br></pre></td></tr></table></figure>

<p>但是要注意这些用法的不同：[\&lt;address&gt;] 和 [AT(&lt;lma&gt;)]必须指定具体的地址，而\ [&gt;&lt;region&gt;] 和\ [AT&gt;&lt;lma region&gt;]只需指定内存空间，具体地址紧接着上一个output section的末尾地址。</p>
<p>经过以上步骤，我们得出如下section定义：（这里只列出2种）</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">SECTIONS</span><br><span class="line">&#123;</span><br><span class="line">　　.my_data ( 0xD0004000 ) : AT ( 0x80000020 )</span><br><span class="line">　　&#123;</span><br><span class="line">　　　　*(.myData)</span><br><span class="line">　　&#125;</span><br><span class="line">　　...</span><br><span class="line">&#125;</span><br><span class="line">/* 或者 */</span><br><span class="line">SECTIONS</span><br><span class="line">&#123;</span><br><span class="line">　　.my_data :</span><br><span class="line">　　&#123;</span><br><span class="line">　　　　*(.myData)</span><br><span class="line">　　&#125; &gt; ram AT&gt; rom</span><br><span class="line">　　...</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="3-2-段的作用"><a href="#3-2-段的作用" class="headerlink" title="3.2 段的作用"></a><font size=3>3.2 段的作用</font></h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">/* Define output sections */</span><br><span class="line">SECTIONS</span><br><span class="line">&#123;</span><br><span class="line"> /* 中间部分省略...*/</span><br><span class="line">  .text :</span><br><span class="line">  &#123;</span><br><span class="line">    . = ALIGN(4);</span><br><span class="line">    *(.text)           /* .text sections (code) */</span><br><span class="line">    *(.text*)          /* .text* sections (code) */</span><br><span class="line">    *(.glue_7)         /* glue arm to thumb code */</span><br><span class="line">    *(.glue_7t)        /* glue thumb to arm code */</span><br><span class="line">    *(.eh_frame)</span><br><span class="line"></span><br><span class="line">    KEEP (*(.init))</span><br><span class="line">    KEEP (*(.fini))</span><br><span class="line"></span><br><span class="line">    . = ALIGN(4);</span><br><span class="line">    _etext = .;        /* define a global symbols at end of code */</span><br><span class="line">  &#125; &gt;FLASH</span><br><span class="line">  /* 中间部分省略...*/</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>这里就是链接脚本的核心功能，我们先不考虑每个段的功能，先了解一下链接脚本到底用来干什么。因为一个工程内可能有多个.c文件，比如代码里面一共3个文件：分别是 main.c 、usart.c 、 start.s 。很明显一个主程序，一个串口驱动，一个启动文件。在实际编译中，会把它们分别编译为 main.o 、usart.o 、 start.o ，假如每个.o文件中都包含.text、.data、.bss段，但是我们知道，程序最后烧入MCU是只有一个文件，这里就涉及到段的合并，也就是上面的命令所实现的功能，把每个.o文件中的相同段合一。</p>
<ul>
<li>一般的程序中包含常见的几个段：text(存放程序)，rodata(存放被初始化的数据)，data(表示初始化不为0的变量)，bss(表示初始化值为默认的全局变量)。</li>
<li>text，rodata放在flash中，而data中的初始化值作为rodata放在flash中，变量在ram中占有空间，bss占ram空间。</li>
</ul>
<h3 id="3-2-isr-vector"><a href="#3-2-isr-vector" class="headerlink" title="3.2 isr_vector"></a><font size=3>3.2 isr_vector</font></h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">/* The startup code goes first into FLASH */</span><br><span class="line">.isr_vector :</span><br><span class="line">&#123;</span><br><span class="line">  . = ALIGN(4);</span><br><span class="line">  KEEP(*(.isr_vector)) /* Startup code */</span><br><span class="line">  . = ALIGN(4);</span><br><span class="line">&#125; &gt;FLASH</span><br></pre></td></tr></table></figure>

<p>这一部分表示中断向量表被链接到段 .isr_vector 内。</p>
<p>（1）点（ . ）  ：表示当前虚拟内存地址(location counter)</p>
<p>（2）ALIGN(4) ：表示四字节对齐。</p>
<p>（3）KEEP ：这个命令来保存所有文件中的 .isr_vector 内容，即使它们没有被调用。也就是在保存中断向量前做四字节对齐，保存后做四字节对齐。</p>
<p>（3）&gt;FLASH ：内容存在上面MEMORY中定义的FLASH中。</p>
<h3 id="3-3-text"><a href="#3-3-text" class="headerlink" title="3.3 text"></a><font size=3>3.3 text</font></h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">/* The program code and other data goes into FLASH */</span><br><span class="line">.text :</span><br><span class="line">&#123;</span><br><span class="line">  . = ALIGN(4);</span><br><span class="line">  *(.text)           /* .text sections (code) */</span><br><span class="line">  *(.text*)          /* .text* sections (code) 所有代码段*/</span><br><span class="line">  *(.glue_7)         /* glue arm to thumb code ARM与THUMB相互调用生成的段 */</span><br><span class="line">  *(.glue_7t)        /* glue thumb to arm code ARM与THUMB相互调用生成的段*/</span><br><span class="line">  *(.eh_frame)       /* 用于链接异常生成的段 */</span><br><span class="line"></span><br><span class="line">  KEEP (*(.init))    /* 构造析构相关 */</span><br><span class="line">  KEEP (*(.fini))    /* 构造析构相关 */</span><br><span class="line"></span><br><span class="line">  . = ALIGN(4);</span><br><span class="line">  _etext = .;        /* define a global symbols at end of code 把当前虚拟地址赋值给_etext，这是一个全局变量 */</span><br><span class="line">&#125; &gt;FLASH</span><br></pre></td></tr></table></figure>

<p>第一个冒号左边的.text就是合并后的.text段，它是由符合花括号内规则的所有内容合并得到的，在刚才的例子里就是 main.o 、usart.o 、 start.o 中的.text段。* 号代表通配符，这里它没有前缀和后缀，也没有 [ ] 内容修饰，所以它代表所有匹配文件。</p>
<ul>
<li>. &#x3D; ALIGN(4);  ：是指4字节对齐。</li>
<li><strong>.</strong> ：小数点表示当前的地址位置。</li>
<li>eh_frame ：段可以自定义，由于编译obj过程中不会生成用户自定义的段，因此在源码中需要指定需要特殊处理的段。</li>
<li>结尾的 &gt;FLASH指上面花括号内的内容都放在第二部分中定义的FLASH空间中。</li>
</ul>
<p>剩下的暂时就不说了，详细的语法结构，我们可以看<a target="_blank" rel="noopener" href="https://sourceware.org/binutils/docs/ld.pdf">ld.pdf (sourceware.org)</a>的3.6 SECTIONS Command一节，有超级详细的说明。</p>
<h1 id="四、多个链接脚本"><a href="#四、多个链接脚本" class="headerlink" title="四、多个链接脚本"></a><font size=3>四、多个链接脚本</font></h1><p>我们的工程中只能有一个链接脚本吗？一开始我以为只能有一个，后来发现，其实可以有多个的，最终他们都会汇集到一起。比如，后边我们学习SRAM的时候，可能会使用链接脚本来定义一个段，然后预存数组到指定的地址。我们直接在STM32CubeMX生成的链接脚本中添加也是没问题的，但是就一个坏处，那就是每次STM32CubeMX更新工程的时候，这个脚本都会重新生成，我们添加的东西也都不复存在，所以我们可以自己新建一个链接脚本，然后在编译的时候一起编译就好啦。</p>
<h2 id="1-新建链接脚本-mine-ld"><a href="#1-新建链接脚本-mine-ld" class="headerlink" title="1. 新建链接脚本 mine.ld"></a><font size=3>1. 新建链接脚本 mine.ld</font></h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">SECTIONS</span><br><span class="line">&#123;</span><br><span class="line">  .sram :</span><br><span class="line">  &#123;</span><br><span class="line">    . = ALIGN(4);</span><br><span class="line">    __SRAM_SYMBOLS = .;       /* create a global symbol at ccmram start */</span><br><span class="line">    *(.sram)</span><br><span class="line">    *(.sram*)</span><br><span class="line">    </span><br><span class="line">    . = ALIGN(4);</span><br><span class="line">    __SRAM_SYMBOLS = .;       /* create a global symbol at ccmram end */</span><br><span class="line">  &#125; &gt;SRAM AT&gt; FLASH</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="2-修改Makefile"><a href="#2-修改Makefile" class="headerlink" title="2. 修改Makefile"></a><font size=3>2. 修改Makefile</font></h2><p>我们需要把我们自己的链接脚本也添加到Makefile中：</p>
<figure class="highlight m"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">#######################################</span><br><span class="line"># LDFLAGS</span><br><span class="line">#######################################</span><br><span class="line"># link script</span><br><span class="line">LDSCRIPT <span class="built_in">=</span> STM32F103ZETx_FLASH.ld mine.ld</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>这样我们那就不用担心更新工程的时候把我们添加的内容清理掉啦。</p>

    </div>

    
    
    

    <footer class="post-footer">




    <div>
        
            <div style="text-align:center;color: #ccc;font-size:14px;">
            ----------本文结束
            <i class="fas fa-fan fa-spin" style="color: #FF1493; font-size: 1rem"></i>
            感谢您的阅读----------
            </div>
        
    </div>





  
  <div class="my_post_copyright"> 
    <p><span>文章标题:</span><a href="/post/ebcf2720.html">LV16-07-开发工具-04-ld链接文件</a></p>
    <p><span>文章作者:</span><a href="/" title="欢迎访问 《苏木》 的学习笔记">苏木</a></p>
    <p><span>发布时间:</span>2023年06月04日 - 22:06</p>
    <p><span>最后更新:</span>2025年06月14日 - 00:25</p>
    <p><span>原始链接:</span><a href="/post/ebcf2720.html" title="LV16-07-开发工具-04-ld链接文件">https://sumumm.github.io/post/ebcf2720.html</a></p>
    <p><span>许可协议:</span><i class="fab fa-creative-commons"></i> <a rel="license" href= "https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者。</p>  
  </div>
  


          <div class="post-tags">
              <a href="/tags/LV16-STM32%E5%BC%80%E5%8F%91/" rel="tag"><i class="fa fa-tag"></i> LV16-STM32开发</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/post/1b5de2cd.html" rel="prev" title="LV16-08-CortexM0概述">
                  <i class="fa fa-angle-left"></i> LV16-08-CortexM0概述
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/post/4e3a140c.html" rel="next" title="LV16-07-开发工具-03-Makefile文件">
                  LV16-07-开发工具-03-Makefile文件 <i class="fa fa-angle-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">

  <div class="copyright">
    &copy; 2017 – 
    <span itemprop="copyrightYear">2025</span>
    <span class="with-love">
      <i class="fa fa-heart"></i>
    </span>
    <span class="author" itemprop="copyrightHolder">苏木</span>
  </div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
      <span>站点总字数：</span>
    <span title="站点总字数">3.7m</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span>站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">225:26</span>
  </span>
</div>




    <span id="sitetime"></span>
    <script defer language=javascript>
        function siteTime()
        {
            window.setTimeout("siteTime()", 1000);
            var seconds = 1000;
            var minutes = seconds * 60;
            var hours = minutes * 60;
            var days = hours * 24;
            var years = days * 365;
            var today = new Date();
            var todayYear = today.getFullYear();
            var todayMonth = today.getMonth()+1;
            var todayDate = today.getDate();
            var todayHour = today.getHours();
            var todayMinute = today.getMinutes();
            var todaySecond = today.getSeconds();
            /*==================================================
            Date.UTC() -- 返回date对象距世界标准时间(UTC)1970年1月1日午夜之间的毫秒数(时间戳)
            year        - 作为date对象的年份，为4位年份值
            month       - 0-11之间的整数，做为date对象的月份
            day         - 1-31之间的整数，做为date对象的天数
            hours       - 0(午夜24点)-23之间的整数，做为date对象的小时数
            minutes     - 0-59之间的整数，做为date对象的分钟数
            seconds     - 0-59之间的整数，做为date对象的秒数
            microseconds - 0-999之间的整数，做为date对象的毫秒数
            ==================================================*/
            var t1 = Date.UTC(2017, 
                              5, 
                              19, 
                              0, 
                              0, 
                              0); //北京时间
            var t2 = Date.UTC(todayYear,todayMonth,todayDate,todayHour,todayMinute,todaySecond);
            var diff = t2-t1;
            var diffYears = Math.floor(diff/years);
            var diffDays = Math.floor((diff/days)-diffYears*365);
            var diffHours = Math.floor((diff-(diffYears*365+diffDays)*days)/hours);
            var diffMinutes = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours)/minutes);
            var diffSeconds = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours-diffMinutes*minutes)/seconds);
            document.getElementById("sitetime").innerHTML="已在这里 "+diffYears+" 年 "+diffDays+" 天 "+diffHours+" 小时 "+diffMinutes+" 分钟 "+diffSeconds+" 秒";
        }
        siteTime();
    </script>



    </div>
  </footer>

  
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up fa-lg"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/next-theme-pjax/0.6.0/pjax.min.js" integrity="sha256-vxLn1tSKWD4dqbMRyv940UYw4sXgMtYcK6reefzZrao=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.umd.js" integrity="sha256-ytMJGN3toR+a84u7g7NuHm91VIR06Q41kMWDr2pq7Zo=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/lozad.js/1.16.0/lozad.min.js" integrity="sha256-mOFREFhqmHeQbXpK2lp4nA3qooVgACfh88fpJftLBbc=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script><script src="/js/pjax.js"></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/hexo-generator-searchdb/1.4.1/search.js" integrity="sha256-1kfA5uHPf65M5cphT2dvymhkuyHPQp5A53EGZOnOLmc=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>




  <script src="/js/third-party/fancybox.js"></script>

  <script src="/js/third-party/pace.js"></script>


  




  

  <script class="next-config" data-name="enableMath" type="application/json">true</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"none","js":{"url":"https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.js","integrity":"sha256-MASABpB4tYktI2Oitl4t+78w/lyA+D7b/s9GEP0JOGI="}}</script>
<script src="/js/third-party/math/mathjax.js"></script>


 
        <div id="click-show-text"
            data-mobile = false
            data-text = 富强,民主,文明,和谐,自由,平等,公正,法制,爱国,敬业,诚信,友善
            data-fontsize = 15px
            data-random= false>
        </div>
       

      
        <script async src=https://cdn.jsdelivr.net/npm/hexo-next-mouse-effect@latest/click/showText.js></script>
      

      
    




    <script async src="/js/fancybox_param.js"></script>





<!-- APlayer本体 -->



</body>
</html>
